package com.lineage.server.timecontroller.pc;

import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.thread.PcOtherThreadPool;
import com.lineage.server.world.World;
import java.util.Collection;
import java.util.Iterator;
import java.util.TimerTask;
import java.util.concurrent.ScheduledFuture;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class AiTimer extends TimerTask {
  private static final Log _log = LogFactory.getLog(AiTimer.class);
  
  private ScheduledFuture<?> _timer;
  
  public void start() {
    int timeMillis = 20000;
    this._timer = PcOtherThreadPool.get().scheduleAtFixedRate(this, 20000L, 20000L);
  }
  
  public void run() {
    try {
      Collection<L1PcInstance> all = World.get().getAllPlayers();
      if (all.isEmpty())
        return; 
      Iterator<L1PcInstance> iter = all.iterator();
      L1PcInstance l1PcInstance = null;
      while (iter.hasNext())
         l1PcInstance = iter.next(); 
    } catch (Exception localException) {
      _log.error("ai验证处理时间轴异常重启", localException);
      PcOtherThreadPool.get().cancel(this._timer, false);
      Object localObject = new AiTimer();
      ((AiTimer)localObject).start();
    } 
  }
}
